﻿using System;

using System.Collections.Generic;
public class Class1
{
    public void MakeCall()
    {
        #region UriExtensionExample
        // Take a base url
        Uri sample = new Uri("http://www.nytimes.com");
        // some highly useful parameters
        Dictionary<String, String> query = new Dictionary<string, string>
        {
            {"param1","nice"},
            {"param2","code man"}
        };
        // create a new url using a chained style of coding
        Uri newSample = sample
            .AppendPath("/pages/world")
            .AppendQueryValues(query);
        // or do something like this
        Uri somewhereElse = sample.AppendPath("pages")
            .AppendPath("world")
            .AppendQueryString("param1=nice&param2=code%20man");
        // prints: http://www.nytimes.com/pages/world?param1=nice&param2=code%20man
        Console.WriteLine(newSample);
        // turn the dictionary into a string with our famous extension method
        String queryString = query.ToQueryString();
        // prints: param1=nice&param2=code%20man
        Console.WriteLine(queryString);
        #endregion
    }
}
